package com.example.mybatis;

import com.example.mapper.UserMapper;
import com.example.pojo.User;
import com.example.util.MybatisUtil;
import org.apache.ibatis.session.SqlSession;

import java.util.List;

public class MybatisDemo02 {
    public static void main(String[] args) {
        SqlSession sqlSession = MybatisUtil.sqlSessionFactory.openSession();
        UserMapper mapper = sqlSession.getMapper(UserMapper.class);
        List<User> userList = mapper.getUserList();
        System.out.println(userList);
        User user = mapper.selectUserById(2);
        System.out.println(user);
        sqlSession.close();
    }
}
